package com.ruoyi.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TMedicalPacsInfo;
import com.ruoyi.system.service.ITMedicalPacsInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * pacs影像信息Controller
 * 
 * @author ruoyi
 * @date 2022-01-01
 */
@RestController
@RequestMapping("/system/pacsInfo")
public class TMedicalPacsInfoController extends BaseController
{
    @Autowired
    private ITMedicalPacsInfoService tMedicalPacsInfoService;

    /**
     * 查询pacs影像信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:pacsInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(TMedicalPacsInfo tMedicalPacsInfo)
    {
        startPage();
        List<TMedicalPacsInfo> list = tMedicalPacsInfoService.selectTMedicalPacsInfoList(tMedicalPacsInfo);
        return getDataTable(list);
    }

    /**
     * 导出pacs影像信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:pacsInfo:export')")
    @Log(title = "pacs影像信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TMedicalPacsInfo tMedicalPacsInfo)
    {
        List<TMedicalPacsInfo> list = tMedicalPacsInfoService.selectTMedicalPacsInfoList(tMedicalPacsInfo);
        ExcelUtil<TMedicalPacsInfo> util = new ExcelUtil<TMedicalPacsInfo>(TMedicalPacsInfo.class);
        return util.exportExcel(list, "pacs影像信息数据");
    }

    /**
     * 获取pacs影像信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:pacsInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tMedicalPacsInfoService.selectTMedicalPacsInfoById(id));
    }

    /**
     * 新增pacs影像信息
     */
    @PreAuthorize("@ss.hasPermi('system:pacsInfo:add')")
    @Log(title = "pacs影像信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TMedicalPacsInfo tMedicalPacsInfo)
    {
        return toAjax(tMedicalPacsInfoService.insertTMedicalPacsInfo(tMedicalPacsInfo));
    }

    /**
     * 修改pacs影像信息
     */
    @PreAuthorize("@ss.hasPermi('system:pacsInfo:edit')")
    @Log(title = "pacs影像信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TMedicalPacsInfo tMedicalPacsInfo)
    {
        return toAjax(tMedicalPacsInfoService.updateTMedicalPacsInfo(tMedicalPacsInfo));
    }

    /**
     * 删除pacs影像信息
     */
    @PreAuthorize("@ss.hasPermi('system:pacsInfo:remove')")
    @Log(title = "pacs影像信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tMedicalPacsInfoService.deleteTMedicalPacsInfoByIds(ids));
    }
}
